import React, { Component } from 'react'

import { Route,withRouter } from 'react-router-dom'


// 用户列表
import UserList from './views/User'
// 添加用户
import AddUser from './views/User/Add'

// 导航
import Nav from './components/Nav'


@withRouter
class App extends Component {

  // eslint-disable-next-line
  constructor(props) {
    super(props);
    
    props.history.listen((route) => {
      console.log(route)
    })
  }
  

  render() {
    return (
      <>
        {/* 导航组件 */}
        <Nav />
        <hr />
        {/* 定义路由  vue=>route.js router-view */}
        <Route exact path="/" component={UserList} />
        <Route exact path="/add" component={AddUser} />
      </>
    )
  }

}

export default App
